﻿Imports SQLSpaceMapper.Enums

Public Class Table

    Public Sub New(ByVal NewName As String, ByVal NewSize As Integer, ObjectType As ObjectTypes, StorageType As PhysicalTable)
        MyBase.New()

        Name = NewName
        Type = ObjectType
        Storage = StorageType

        Me.Partitions.Add(New Partition())

    End Sub

    Public Name As String
    Public Type As ObjectTypes
    Public Storage As PhysicalTable
    Public Partitions As List(Of Partition)

    Public ReadOnly Property DataSize As Integer
        Get
            For Each p As Partition In Partitions
                DataSize += p.Size
            Next
        End Get
    End Property

    Public ReadOnly Property TotalSize As Integer
        Get
            Return DataSize + IndexSize
        End Get
    End Property

    Public ReadOnly Property IndexSize As Integer
        Get
            For Each i As Index In Indexes.Values
                IndexSize += i.Size
            Next
        End Get
    End Property

    Public Indexes As New Dictionary(Of String, Index)

End Class

